package Demo3;

public class Computer {
    public void open(){
        System.out.println("open computer");
    }
    public void close(){
        System.out.println("close computer");
    }
    public void useUSB(USB usb){
        usb.openDevice();
        if(usb instanceof Mouse){
            Mouse mouse=(Mouse) usb;
            mouse.click();
        }else {
            KeyBord keyBord=(KeyBord) usb;
            keyBord.input();
        }
        usb.closeDevice();
    }
}
